package jgl.vajra.management.part.mine.activity;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;

import java.util.ArrayList;
import java.util.List;

import jgl.vajra.management.R;
import jgl.vajra.management.databinding.ActivityCarDetailsFailBinding;
import jgl.vajra.management.databinding.ItemCarDetailsFailBinding;
import jgl.vajra.management.part.mine.contract.CarDetailsFailContract;
import jgl.vajra.management.part.mine.viewModel.CarDetailsFailViewModel;
import jgl.vajra.management.widget.databindingadapter.BaseDataBindingDecorator;
import jgl.vajra.management.widget.databindingadapter.SingleTypeBindingAdapter;
import jgl.vajra.management.widget.mvvm.factory.CreateViewModel;
import jgl.vajra.management.widget.mvvm.view.BaseMVVMActivity;

@CreateViewModel(CarDetailsFailViewModel.class)
public class CarDetailsFailActivity extends BaseMVVMActivity<CarDetailsFailViewModel, ActivityCarDetailsFailBinding> implements CarDetailsFailContract.View {
    @Override
    public int getLayoutId() {
        return R.layout.activity_car_details_fail;
    }

    @Override
    public void initView() {
        super.initView();
        mBinding.setView(this);

        List<String> list = new ArrayList<>();
        list.add("身份证照片");
        list.add("身份证照片");
        list.add("身份证照片");
        list.add("身份证照片");

        // 不可嵌套滑动
        mBinding.recyclerView.setNestedScrollingEnabled(false);
        // 取消head 的 recycleView的焦点
        mBinding.recyclerView.setFocusableInTouchMode(false);
        //设置布局管理器
        mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
        SingleTypeBindingAdapter adapter = new SingleTypeBindingAdapter(this, list, R.layout.item_car_details_fail);
        mBinding.recyclerView.setAdapter(adapter);
        adapter.setItemDecorator((BaseDataBindingDecorator<String, ItemCarDetailsFailBinding>) (binding, position, viewType, data) -> {

            // 不可嵌套滑动
            binding.itemRecyclerView.setNestedScrollingEnabled(false);
            // 取消head 的 recycleView的焦点
            binding.itemRecyclerView.setFocusableInTouchMode(false);
            //设置布局管理器
            binding.itemRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
            SingleTypeBindingAdapter itemAdapter = new SingleTypeBindingAdapter(this, list, R.layout.item_car_details_item);
            binding.itemRecyclerView.setAdapter(itemAdapter);

        });
    }

    //删除车
    @Override
    public void onDeleteCar() {
    }

    //保存
    @Override
    public void onDetermine() {

    }
}

